<template>
  <div class="content-box" @click="detailShow = false">
    <div class="tab-box flex ac">
      <div
        @click="tabActive = item.id"
        :class="tabActive == item.id ? 'tab-items-active' : ''"
        v-for="item in tabList"
        :key="item.id"
        class="tab-items flex ac jc"
      >
        {{ `${item.name} ${item.num}` }}
      </div>
    </div>
    <div class="padding-box">
      <div class="search-box">
        <el-form
          :inline="true"
          :model="searchFormInline"
          class="demo-form-inline"
        >
          <el-form-item label="">
            <el-input
              v-model="searchFormInline.user"
              placeholder="请输入设备二维码"
              clearable
            />
          </el-form-item>
          <el-form-item label="">
            <el-input
              v-model="searchFormInline.user"
              placeholder="请输入设备编码"
              clearable
            />
          </el-form-item>
          <el-form-item label="">
            <el-select
              v-model="searchFormInline.value"
              placeholder="请选择设备归属"
              size="large"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button class="search-btn" type="primary" @click="">
              查询
            </el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="table-box">
        <el-table
          :data="tableData"
          height="100%"
          stripe
          :header-cell-style="{
            color: '#828A9D',
            textAlign: 'center',
            height:'60px'
          }"
          :cell-style="{ textAlign: 'center', color: '#1B2431' }"
        >
          <el-table-column fixed prop="date" label="设备型号" />
          <el-table-column prop="name" label="设备二维码" />
          <el-table-column prop="city" label="设备归属" />
          <el-table-column prop="zip" label="总收益" />
          <el-table-column prop="zip" label="绑定记录">
            <template #default="scope">
              <el-button type="primary" link @click.stop="detailShow = true">
                详情
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pagination-box flex jc">
        <el-pagination
          v-model:page-size="searchForm.pageSize"
          v-model:current-page="searchForm.page"
          :total="searchForm.totalAll"
          @change="sizePageChangeFunc"
          background
          layout="total,sizes,prev, pager, next,jumper"
        />
      </div>
    </div>
  </div>
  <!-- 详情 -->
  <div class="detail-dialog" :class="detailShow ? 'detail-dialog-show' : ''">
    <div class="title-box flex ac jb">
      <p class="title">解绑记录</p>
      <el-icon size="22" color="#979797" @click="detailShow = false"><Close /></el-icon>
    </div>
    <div class="detail-cotent">
      <div class="detail-cotent-items flex ac">
        <p class="title">解绑人：</p>
        <p class="content">超级管理员</p>
      </div>
      <div class="detail-cotent-items flex ac">
        <p class="title">账号：</p>
        <p class="content">173787878787</p>
      </div>
      <div class="detail-cotent-items flex ac">
        <p class="title">店铺：</p>
        <p class="content">敬山派出所大厅</p>
      </div>
      <div class="detail-cotent-items flex ac">
        <p class="title">区域：</p>
        <p class="content">福建省厦门市思明区</p>
      </div>
    </div>
  </div>
</template>
<script setup>
import { onMounted, reactive, toRefs, ref } from 'vue'
import { Document, Close } from '@element-plus/icons-vue'
onMounted(() => {
  console.log('index')
})
let detailShow = ref(false)
let options = ref([
  {
    value: 'Option1',
    label: 'Option1',
  },
  {
    value: 'Option2',
    label: 'Option2',
  },
  {
    value: 'Option3',
    label: 'Option3',
  },
  {
    value: 'Option4',
    label: 'Option4',
  },
  {
    value: 'Option5',
    label: 'Option5',
  },
])
let searchForm = ref({
  pageSize: 10,
  page: 1,
  totalAll: 0,
})
const sizePageChangeFunc = e => {
  console.log(searchForm.value)
}
let tableData = ref([
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
])
const shortcuts = [
  {
    text: '最近一周',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
      return [start, end]
    },
  },
  {
    text: '最近一个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
      return [start, end]
    },
  },
  {
    text: '最近三个月',
    value: () => {
      const end = new Date()
      const start = new Date()
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
      return [start, end]
    },
  },
]
let searchFormInline = ref({})
let tabActive = ref(1)
let tabList = ref([
  {
    name: '已绑店',
    num: 3,
    id: 1,
  },
  {
    name: '未绑店',
    num: 213,
    id: 2,
  },
  {
    name: '全部设备',
    num: 433,
    id: 3,
  },
])
</script>
<style scoped lang="scss">
@import './index.scss';
</style>